﻿@model IEnumerable<TaoNiuOA.Models.Workday>
@{
    ViewBag.Title = "工作时间";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<fieldset>
    <legend>工作时间 | <a href="../Worktime/Index">工作时间生成设置</a></legend>
    <div>
        <ul>
            <li><a href="?mod=thismonth">本月</a></li>
            <li><a href="?mod=nextmonth">下个月</a></li>
            <li><a href="?mod=lastmonth">上个月</a></li>
        </ul>
    </div>
    <div>
        <form id="form1">
        <script src="../../Plusins/timeplus/WdatePicker.js" type="text/javascript"></script>
        <input type="text" id="searchTime" name="searchTime" onfocus="WdatePicker({dateFmt:'yyyy-MM'})"
            class="Wdate" />
        <input type="button" id="btnSearch" name="btnSearch" value="查询" />(提示:输入年月即可查询或设置工作时间.)
        </form>
    </div>
    <table>
        <tr>
            <th>
                日期
            </th>
            <th>
                星期
            </th>
            <th>
                上班时间
            </th>
            <th>
                下班时间
            </th>
            <th>
                是否假日
            </th>
            <th>
                操作
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Date)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.DayOfWeek)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.OnWork)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.OffWork)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.IsHoliday)
                </td>
                <td>
                    @Html.ActionLink("编辑", "Edit", new { id = item.WorkDayID })
                </td>
            </tr>
        }
    </table>
</fieldset>
<script type="text/javascript">
    var btn = document.getElementById("btnSearch");
    var frm = document.getElementById("form1");
    var search = document.getElementById("searchTime");
    btn.onclick = function () {
        if (che()) {
            frm.method = "post";
            frm.action = "?mod=" + search.value;
            frm.submit();
        }
    }
    function che() {
        if (search.value == "") {
            alert("请选择时间");
            return false;
        }
        return true;
    }
</script>
